#!/bin/sh
#
# Remove the iassist apache 2 configuration
#

apath=/usr/local/Apache2
hfile="${apath}/conf/httpd.conf"

if [ -r "${hfile}" ] ; then

	if ( grep -q -e "^#Begin: Added by Lasso" "${hfile}" )
	then
		while [ $? = 0 ];
		do
			ed - "${hfile}" > /dev/null << 'LASSOREMOVE'
/#Begin: Added by Lasso [0-9]/,/#End: Added by Lasso [0-9]/d
w
q
LASSOREMOVE
		done

	else
		echo "No changes made to httpd.conf file."
	fi

	if ( "${apath}/bin/apachectl" configtest 2> /dev/null )
	then
		"${apath}/bin/apachectl" restart
	else
		echo "Apache config test did not work...not starting Apache:"
		"${apath}/bin/apachectl" configtest
	fi

	echo ""

else
	echo "Nothing to do, no httpd.conf file found."
fi
